#ifndef _C_PLANE_ANALYZE_H_
#define _C_PLANE_ANALYZE_H_


#pragma once


#ifndef _INCLUDED_PCL_H_
#define _INCLUDED_PCL_H_

#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/ModelCoefficients.h>
#include <pcl/sample_consensus/method_types.h>
#include <pcl/sample_consensus/model_types.h>
#include <pcl/segmentation/sac_segmentation.h>
#include <pcl/filters/extract_indices.h>
#include <pcl/features/normal_3d.h>
#include <pcl/kdtree/kdtree.h>
#include <pcl/segmentation/extract_clusters.h>

#endif

#include <boost/shared_ptr.hpp>



class CplaneAnalyze
{
public:
	CplaneAnalyze(void);
	virtual ~CplaneAnalyze(void);

	void generatePCLCloud(
		ObstInfo& oiObst,
		pcl::PointCloud<pcl::PointXYZ>::Ptr cloud
		);

	void initPlaneSegmentor(
		pcl::SACSegmentation<pcl::PointXYZ>& seg,
		float distanceThreshold = 2.0f,
		UINT maxIters = 30
		);

	bool estimatePlanarModel(
		pcl::SACSegmentation<pcl::PointXYZ>& seg,
		pcl::PointCloud<pcl::PointXYZ>::Ptr cloud, 
		PlaneInfo& plane,
		bool analySize = false,
		float pointCountThreshold = 0.4f
		);

	bool estimatePlanarModel(
		pcl::SACSegmentation<pcl::PointXYZ>& seg,
		pcl::PointCloud<pcl::PointXYZ>::Ptr cloud, 
		pcl::PointIndices& inliers,
		PlaneInfo& plane,
		bool analySize = false,
		float pointCountThreshold = 0.4f
		);

	cv::Size2f getPlaneSize(
		PlaneInfo& plane
		);

};


#endif